/*
 * @(#)Order.java 2013-4-11 下午03:52:57
 *
 * Copyright 2013 Beijing Axesline Technology Co..Ltd All rights reserved.
 * 该程序的所有权为北京铭扬谷地咨询有限公司 .
 * 使用之前必须得到北京铭扬谷地咨询有限公司的许可;
 */
package com.minyond.demo.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * <p>Description:</p>
 * <p>Copyright: Copyright (c)2013</p>
 * <p>Company: minyond</p>
 * <P>Created Date :2013-4-11</P> 
 * @author zhangfeng
 * @version 1.0
 */
@Entity
@Table(name = "ss_order")
public class Order {
    
    private Long id;
    
    private String orderName;
    private User user;
    
    private Date createDate;
    
    
    public Order(){
        
    }
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    
    @ManyToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="user_id")
    public User getUser() {
        return user;
    }
    public void setUser(User user) {
        this.user = user;
    }
    
    @NotBlank
    public String getOrderName() {
        return orderName;
    }
    public void setOrderName(String orderName) {
        this.orderName = orderName;
    }
    
    //设定JSON序列化时的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}
